<?php

require_once 'config/config.php';
/**
 * template content
 */
$act = Core::getParam("menu");
$detail = Core::getParam("detail");
$feed = Core::getParam("feed");
$feed_id = Core::getParam("feedid");
$date = Core::getParam("date");
$page = Core::getParam("page");
$num_page = 15;
$today = date('Y-m-d h:i');
$_today = strtotime($today);
//var_export($act."--".$detail."--".$page);die;
$menu = array(
    "dudoan" => F_PATH . "dudoan_all" . EXT,
    "dudoanbongda" => F_PATH . "dudoanketqua" . EXT,
    "tamdiem" => F_PATH . "dudoantamdiem" . EXT,
//    "dudoansoxo" => F_PATH . "dudoansoxo" . EXT,
    "dudoansoxo" => F_PATH . "error" . EXT,
    "ketqua" => F_PATH . "ketquatrandau" . EXT,
    "giaithuong" => F_PATH . "giaithuong" . EXT,
    "verify" => F_PATH . "xacthuc" . EXT,
    "update-info" => F_PATH . "thaydoithongtin" . EXT,
    "change-password" => F_PATH . "thaydoimatkhau" . EXT,
    "recharge" => F_PATH . "napthe" . EXT,
    "predict" => F_PATH . "danhsachdudoan_profile" . EXT,
    "list-bets" => F_PATH . "danhsachdudoan" . EXT,
    "transactions" => F_PATH . "giaodich" . EXT,
    "login" => F_PATH . "login_form" . EXT,
    "lienhe" => F_PATH . "lienhe" . EXT,
    "thele" => F_PATH . "thele" . EXT,
    "tintuc" => F_PATH . "news" . EXT,
    "logout" => F_PATH . "logout" . EXT
);

$menu_detail = array(
    "feed" => F_PATH . "feed_detail" . EXT,
);

$menu_be = array(
    "login" => B_PATH . "login" . EXT,
    "add-dudoanvui" => B_PATH . "add_dudoanvui" . EXT,
    "dudoanvui" => B_PATH . "view_dudoanvui" . EXT,
    "adm_matchview" => B_PATH . "view_trandau" . EXT,
    "adm_matchupdate" => B_PATH . "update_trandau" . EXT,
    "adm_tourview" => B_PATH . "view_giaidau" . EXT,
    "adm_tourupdate" => B_PATH . "update_giaidau" . EXT,
    "adm_teamview" => B_PATH . "view_doibong" . EXT,
    "adm_teamupdate" => B_PATH . "update_doibong" . EXT,
    "adm_oddviewfb" => B_PATH . "view_dudoan" . EXT,
    "adm_oddupdate" => B_PATH . "update_dudoan" . EXT,
    "adm_newsview" => B_PATH . "view_tintuc" . EXT,
    "adm_newsupdate" => B_PATH . "update_tintuc" . EXT,
);
/**
 * template dangky
 */
if (EMAIL != "") {
    $user_info = Frontend::findUserByEmail(EMAIL);
} else {
    $_menu = array(
        "dangky" => F_PATH . 'dangky' . EXT
    );
}
/**
 * login admin
 */
if (USERNAME != "") {
    $a_info = Backend::findUserById(ID);
}
/*
 * nội dung của index
 */
$content = ($act == '' || $menu[$act] == '') ? F_PATH . "content" . EXT : $menu[$act];
/**
 * nội dung của content 
 */
$_content = ($act == '' || $_menu[$act] == '') ? F_PATH . "home" . EXT : $_menu[$act];
/**
 *  nội dung content detail
 */
$content_detail = ($feed == '' || $feed_id == '') ? "" : F_PATH . "feed_detail" . EXT;
/**
 * nôi dung backend
 */
$content_be = ($act == "admin" && $detail == "") ? B_PATH . "view_trandau" . EXT : $menu_be[$detail];
if ($act == "admin") {
    require_once B_PATH . "template/index" . EXT;
} else {
    require_once F_PATH . "template/index" . EXT;
}

?>